$(function () {
    // 微信jssdk认证
    var ajaxurl = '/tool/wxsign';
    var query = new Object();
    var thisurl = location.href.split('#')[0]; //页面url#前的完整url,可alert弹出查看
    query.thisurl = $.trim(thisurl);
    query.post_type = "json";
    $.ajax({
        url: ajaxurl,
        data: query,
        type: "POST",
        dataType: "json",
        success: function (ress) {//成功则执行JS-SDK
            //console.log(ress);//查看返回结果
            // 执行JS_SDK
            wx.config({
                debug: false,
                appId: ress.appid,
                timestamp: ress.timestamp,
                nonceStr: ress.nonceStr,
                signature: ress.signature,
                jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage']
            });
        }
        , error: function (ress) {
            //console.log(ress);
        }
    });
});